<template>
  <!-- 基本信息 -->
  <div class="bg-white my-[10px]">
    <BaseHead style="border-bottom: 0">基本信息</BaseHead>
    <BaseTable>
      <tr>
        <td class="td-name">科研标准名称</td>
        <td>{{ detailData.name }}</td>
        <td class="td-name">科目编号前缀</td>
        <td>{{ detailData.prefix }}</td>
      </tr>
      <tr>
        <td class="td-name">经费管理政策文件</td>
        <td>
          <template v-if="detailData.policyFileList">
            <p v-for="item in detailData.policyFileList" :key="item.id" class="my-[5px]">
              {{ item.name
              }}<el-link type="primary" @click="handleDownload(item.id, item.name)" class="ml-[5px]"
                >下载</el-link
              >
            </p>
          </template>
        </td>
        <td class="td-name">是否实行间接费</td>
        <td>
          <CustomLabel
            :map="{ 0: '否', 1: '是' }"
            :mapKey="detailData.executeIndirectFee"
          ></CustomLabel>
        </td>
      </tr>
    </BaseTable>
  </div>
  <!-- 评审标准 -->
  <div class="bg-white mt-[10px]">
    <BaseHead style="border-bottom: 0"> 预算科目 </BaseHead>
    <el-table
      :data="detailData.subjectList"
      class="w-full"
      border
      row-key="code"
      default-expand-all
      :tree-props="{ hasChildren: 'hasChild' }"
      stripe
    >
      <el-table-column prop="code" label="预算科目编号" />
      <el-table-column label="预算科目名称" prop="name" />
      <el-table-column label="经费调整限制" width="200px">
        <template #default="{ row }">
          <CommonLabel :dataList="feeList" :value="row.feeLimit" />
        </template>
      </el-table-column>
      <el-table-column label="预算填写说明" prop="note" />
    </el-table>
  </div>
</template>

<script setup>
import BaseHead from "@/views/project/components/BaseHead.vue";
import BaseTable from "@/views/project/components/BaseTable.vue";
import CommonLabel from "@/views/project/components/CommonLabel.vue";
import CustomLabel from "@/views/project/components/CustomLabel.vue";
import { recordsDetail } from "@/api/project/zx/ysbzsz";
import useCommonFetch from "@/hooks/useCommonFetch";
import { handleDownload } from "@/utils/main";
const feeList = useCommonFetch("经费调整限制");
const props = defineProps({
  operateId: String,
});
const detailData = ref({});
//获取记录详情
const getDetail = async () => {
  try {
    const res = await recordsDetail(props.operateId);
    detailData.value = res.data;
  } catch (error) {
    console.log(error);
  }
};
onMounted(() => {
  getDetail();
});
</script>

<style scoped lang="scss"></style>
